From: Florian Müllner Date: Sat, 12 Feb 2011 22:03:30 +0000 (+0100) Subject: search-entry: Handle find-as-you-type activation internally X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~8987 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=0ae44f40157d59dd70f1050630286fb8dc8ca8ed;p=gnome-shell.git search-entry: Handle find-as-you-type activation internally To enable find-as-you-type when entering the overview and disabling it when leaving, we used a chain of functions calls from ViewSelector over SearchTab to SearchEntry. As find-as-you-type should be enabled while the overview is shown, the activation/deactivation can be handled entirely by the SearchEntry itself by tying it to the entry's visibility. https://bugzilla.gnome.org/show_bug.cgi?id=642196 --- diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js index 9575e296e..636994ccc 100644 --- a/js/ui/viewSelector.js +++ b/js/ui/viewSelector.js @@ -39,6 +39,7 @@ SearchEntry.prototype = { this.reset(); })); this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('notify::mapped', Lang.bind(this, this._onMapped)); global.stage.connect('notify::key-focus', Lang.bind(this, this._updateCursorVisibility)); @@ -56,17 +57,17 @@ SearchEntry.prototype = { this.entry.set_cursor_visible(false); }, - show: function() { - if (this._capturedEventId == 0) + _onMapped: function() { + if (this.actor.mapped) { + // Enable 'find-as-you-type' this._capturedEventId = global.stage.connect('captured-event', Lang.bind(this, this._onCapturedEvent)); - this.entry.set_cursor_visible(true); - this.entry.set_selection(0, 0); - }, - - hide: function() { - if (this._capturedEventId > 0) { - global.stage.disconnect(this._capturedEventId); + this.entry.set_cursor_visible(true); + this.entry.set_selection(0, 0); + } else { + // Disable 'find-as-you-type' + if (this._capturedEventId > 0) + global.stage.disconnect(this._capturedEventId); this._capturedEventId = 0; } }, @@ -266,13 +267,6 @@ SearchTab.prototype = { })); }, - setFindAsYouType: function(enabled) { - if (enabled) - this._searchEntry.show(); - else - this._searchEntry.hide(); - }, - show: function() { BaseTab.prototype.show.call(this); @@ -580,8 +574,6 @@ ViewSelector.prototype = { }, show: function() { - this._searchTab.setFindAsYouType(true); - if (this._itemDragBeginId == 0) this._itemDragBeginId = Main.overview.connect('item-drag-begin', Lang.bind(this, this._switchDefaultTab)); @@ -596,8 +588,6 @@ ViewSelector.prototype = { }, hide: function() { - this._searchTab.setFindAsYouType(false); - if (this._keyPressId > 0) { this.actor.disconnect(this._keyPressId); this._keyPressId = 0;